//
//  MPFeedbackView.m
//  MarkPlatform
//
//  Created by 敖然 on 2017/12/23.
//  Copyright © 2017年 AT. All rights reserved.
//

#import "MPFeedbackView.h"
#import "UIView+DashLine.h"

@interface MPFeedbackView()

@property (weak, nonatomic) IBOutlet UIImageView *qrCodeImageView;
@property (weak, nonatomic) IBOutlet UIView *leftLineView;
@property (weak, nonatomic) IBOutlet UIView *rightLineView;

@end

@implementation MPFeedbackView

#pragma mark - action

- (void)layoutSubviews {
    [super layoutSubviews];
    [self drawLineWithView:self.leftLineView];
    [self drawLineWithView:self.rightLineView];
}

- (IBAction)saveQRCode:(MPAppButton *)sender {
    UIImageWriteToSavedPhotosAlbum(self.qrCodeImageView.image, self, @selector(image:didFinishSavingWithError:contextInfo:), NULL);
}
// 保存相册回调方法
- (void)image: (UIImage *) image didFinishSavingWithError: (NSError *) error contextInfo: (void *) contextInfo {
    NSString *msg = nil ;
    if(error != NULL){
        msg = @"保存图片失败" ;
    }else{
        msg = @"保存图片成功" ;
    }
    [MBProgressHUD showMessage:msg];
}

#pragma mark - privite

- (void)drawLineWithView:(UIView *)view {
    [self drawLineOfDashByCAShapeLayer:view lineLength:3 lineSpacing:1 lineColor:[UIColor colorWithRGB:0xcfcfcf] lineWidth:0.5];
//    [self.leftLineView layoutIfNeeded ];
}

@end
